<div class="sidebar col-md-4" id='sidebar'>
  <div class="panel profile panel-default">
    <div class="panel-body">
      <div class="media">
        <div class="avatar media-left">
          <div class='image'><%= user_avatar_tag(@user,:big, link: false) %></div>
          <div class="level"><%= render_user_level_tag(@user) %></div>
        </div>
        <div class="media-body">
          <div class="item">
            <%= @user.fullname %>
            <span class="opts pull-right">
              <% if admin? %>
                <%= link_to icon_tag("pencil", label: "修改"), edit_cpanel_user_path(@user.id) %>
              <% end %>
            </span>
          </div>
          <div class="item number">
            第 <%= @user.id %> 位<%= t("menu.users")%>
          </div>
          <div class="item number">
            <span title="注册日期"><%= @user.created_at.to_date %></span>
            <% if @user.location.present? %> • <span title="所在地"><%= location_name_tag(@user.location) %></span><% end %>
          </div>
          <div class="item counts">
            <span><%= @user.topics_count %></span> 篇帖子 • <span><%= @user.replies_count %></span> 条回帖
          </div>
        </div>
      </div>
      <div class="follow-info row">
        <div class="col-sm-4 followers" data-login="<%= @user.login %>">
          <%= link_to @user.followers_count, followers_user_path(@user), class: "counter" %>
          <%= link_to "关注者", followers_user_path(@user), class: "text" %>
        </div>
        <div class="col-sm-4 following">
          <%= link_to @user.following_count, following_user_path(@user), class: "counter" %>
          <%= link_to "正在关注", following_user_path(@user), class: "text" %>
        </div>
        <div class="col-sm-4 stars">
          <%= link_to @user.favorite_topics_count, favorites_user_path(@user), class: "counter" %>
          <%= link_to "收藏", favorites_user_path(@user), class: "text" %>
        </div>
      </div>
      <% if !owner? @user %>
      <div class="buttons row">
        <div class="col-sm-6">
          <%= follow_user_tag(@user) %>
        </div>

        <div class="col-sm-6">
          <%= block_user_tag(@user) %>
        </div>
      </div>
      <% end %>
    </div>
  </div>
  <div class="panel panel-default" id="user_github_repos">
    <% if not user.github.blank? %>
      <div class="panel-heading">GitHub Public Repos</div>
      <ul class="list-group">
        <% user.github_repositories.each do |item| %>
        <li class="list-group-item">
          <div class="title">
            <%= link_to truncate(item[:name], length: 25), item[:url], target: "_blank", rel: "nofollow" %>
            <span class="watchers" title="<%= item[:watchers] %> Watchers"><%= item[:watchers] %></span>
          </div>
          <p class="desc">
            <%= truncate(item[:description], length: 100)  %>
        </li>
        <% end %>
      </ul>
      <div class="panel-footer more">
        <%= link_to "More on GitHub", user.github_url, target: "_blank", rel: "nofollow" %>
      </div>
    <% else %>
      <div class="panel-body">
        未设置 GitHub 信息.
      </div>
    <% end %>
  </div>
</div>
